package com.arpa.wms.domain.enums;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.enums.IEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: xuyang
 * @Date 2021/03/11
 * @Description: 订单单据来源枚举
 */
public enum DeliverySourceTypeEnum implements IEnum<String> {
    /**
     * 订单单据来源类型
     */
    WMS("wms","手工创建"),
    OMS("oms","OMS"),
    QIMEN("qimen","奇门"),
    OTHER("other","其他");

    /**
     * 值
     */
    private String value;

    /**
     * 描述
     */
    private String desc;

    DeliverySourceTypeEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    /**
     * 翻译
     * @param value
     * @return
     */
    public static String translate(String value){
        DeliverySourceTypeEnum item = ENUM_MAP.get(value);
        if(item != null){
            return item.getDesc();
        }
        return StrUtil.EMPTY;
    }

    private static final Map<String, DeliverySourceTypeEnum> ENUM_MAP = new HashMap();


    public static DeliverySourceTypeEnum getEnumByValue(String value) {
        return ENUM_MAP.get(value);
    }



    @Override
    public String getValue() {
        return value;
    }

    @Override
    public String toString(){
        return this.desc;
    }

    public String getDesc() {
        return desc;
    }

}
